
<!--
* description: 弹窗
* author: mwh
* createdDate: 2010-11-21
-->
<template>
  <section class="edit">
    <el-dialog v-dialogDrag
      :close-on-click-modal="false"
      :title="textMap[popupsState]"
      :append-to-body="true"
      :visible.sync="curPopupsVisible"
      @close="sendCode"
      width="1000px"
    >
      <dialogHeader
        slot="title"
        :title="textMap[popupsState]"
        :styleType="$store.state.app.dialogType"
      ></dialogHeader>
      <div class="filter-container filter-params">
        <el-row :gutter="26">
          <component
            v-for="comp in tableComponents.filter(o => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire+ comp.compKey : comp.compKey"
            :validrule="comp.validrule"
            :key="comp.compKey"
            :codeField="comp.codeField"
            :textField="comp.textField"
            :popupsKey="comp.compKey"
            :is="comp.component"
            :code="formField[comp.codeField]"
            :text="formField[comp.textField]"
            :changeCodeArray="comp.changeCodeArray"
            :inputType="comp.inputType"
            @changeDropValue="getDropValue"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
            :disabled="comp.disabled"
            :isRequire="comp.isRequire"
            :span="comp.span || 8"
            :labelName="comp.labelName"
            :lookuptype="comp.lookuptype"
            :dateOptionsType="comp.dateOptionsType"
            :isMul="false"
          ></component>
        </el-row>
      </div>
      <div
        slot="footer"
        class="dialog-footer"
      >
        <el-button
          v-for="comp in tableButtons"
          :key="comp.compKey"
          :type="comp.type"
          @click="comp.clickEvent"
        >{{comp.text}}</el-button>
      </div>
    </el-dialog>
  </section>
</template>
<script>
import { formMixins } from "@/components/mixins/formMixins";
import { crmApis } from "@/api/apiList/crm.js";
import OneTableTemplate from "@/components/crm/Template/crmonePage";
export default {
  // 组件混入对象
  mixins: [formMixins],
     components: {
    dialogHeader: () => import("@/components/dialogHeader") //弹窗标题
  },
  data() {
    return {
      // 保存API配置对象
      apiConfig: crmApis.csDbDudaoDlrRefMutationUpdate,
      // 动态组件-按钮
      tableButtons: [
        {
          compKey: "btnKey1",
          type: "primary",
          size: "small",
          clickEvent: () => this.save(),
          text: "保存",
        }
      ],
      // 动态组件-查询条件
      tableComponents: [
        {
            compKey: "compKey1",
            labelName: "礼品名称",
            codeField: "refType",
            component: () => import("@/components/org/commonInput"),
            type: "dropdownList",
            isRequire: true,
            isMust: true,
            // disabled: this.popupsState === "edit" ? true : false,
        },
        {
            compKey: "compKey2",
            labelName: "市场价",
            codeField: "refType",
            component: () => import("@/components/org/commonInput"),
            type: "dropdownList",
            isRequire: true,
            isMust: true,
            // disabled: this.popupsState === "edit" ? true : false,
        },
        {
            compKey: "compKey3",
            labelName: "成本价",
            codeField: "dudaoPersonName",
            component: () =>import("@/components/org/commonInput"),
            isRequire: true,
            isMust: true,
        },
        {
            compKey: "compKey3",
            labelName: "礼品单位",
            codeField: "dudaoPersonName",
            component: () =>import("@/components/org/commonInput"),
            isRequire: true,
            isMust: true,
        },
        {
            compKey: "compKey4",
            labelName: "是否启用",
            codeField: "isEnable",
            component: () => import("@/components/crm/Select/crmIsEnable"),
            type: "dropdownList",
            isRequire: true,
            isMust: true,
            isMul: false,
        },
        {
            compKey: "compKey5",
            labelName: "礼品描述",
            codeField: "dudaoPersonName",
            component: () => import("@/components/crm/textbox/crmTextInput"),
            isRequire: false,
            isMust: true,
            inputType:"textarea",
            span:16
        },
      ],
      // 标题
      textMap: {
        edit: "网点礼品维护",
        add: "网点礼品维护"
      },
      // 表单数据（无需赋值，由混入对象赋值）
      formField: {
        refType: "",
        dudaoPersonId: "",
        // dudaoPersonName:"",
        refId:"",
        isEnable: "",
        updateControlId:"",
      },
      isdyc:"0"
    };
  },
  methods: {
    //保存
    save() {
      debugger

    }
  }
};
</script>
